import React, { memo, useCallback } from 'react'
const Input = memo(function Input({onChange}) {
  console.log('Input render');
  return <input onChange={(e)=>onChange(e.target.value)} />;
});
export default function UseCallbackApp() {
    const [count, setCount] = React.useState(1)
    const changeHandler = useCallback((value) => {
        console.log(value, 'value===');
    }, [])
  return (
    <div>
        <h1>UseCallbackApp</h1>
        {/* 把函数作为prop传给子组件 */}
        <Input onChange={changeHandler} />
        <button onClick={()=>setCount(count+1)}>{count}</button>
    </div>
  )
}
